<template>
	<view>
		
		<view>
			<div class="coupon-list"      >
			  <div class="item acea-row row-center-wrapper" v-for="data in list" :class="[{green:data.couponType==3},{blue:data.couponType==2}]"  >
			    <div class="money" >
			      <div>
			        ￥<span class="num">{{ data.couponPrice }}</span>
			      </div>
			      <div class="pic-num">满{{ data.useMinPrice }}元可用</div>
			    </div>
			    <div class="text">
			      <div class="condition line1">
			        {{ data.couponTitle }}
			      </div>
			      <div class="data acea-row row-between-wrapper"  >
			        <div ><image :src="data.yxUser.avatar" class="ttt" mode="heightFix"></image>{{data.yxUser.nickname}} {{data.yxUser.phone}}</div>
					 <div >扫码时间:{{data.useTime}}</div>
					 <!-- <div>
						<div class="bnt bg-color-red" >点击核销</div>
					 </div> -->
			        
			      </div>
			    </div>
			  </div>
			</div>
		</view>
		
		
	</view>
</template>



<script>
	import {getCouponsList} from '@/api/couponqr';
	
	export default {
		data() {
			return {
				load:true,
				type:"",
				page:{
					page:1,
					limit:10
				},
				list:[]
			}
		},
		onLoad(e) {
				this.type=e.type
		},
		mounted() {
			this.getList();
		},
		methods: {
			getList(){
				if(this.load){
					getCouponsList(this.type,this.page).then(e=>{
						if(e.data.length==0){
							uni.showToast({
								title:"已加载完成",
								icon:"none"
							})
							this.load=false
						}else{
							for(let p of e.data){
								this.list.push(p);
							}
						}
						uni.stopPullDownRefresh();
						this.page.page++;
					})
					
				}
			}
		},
		onReachBottom(){
			this.getList();
		},
		onPullDownRefresh(){
			this.list=[]
			this.page.page=1
			this.getList()
		},
	}
</script>

<style scoped>
	.ttt{
		height: 15px;
		border-radius: 50%;
		margin-right: 5px;
	}
	.green{
		filter: hue-rotate(140deg)
	}
	.blue{
	filter: hue-rotate(225deg);
	}
</style>
